import request, { headers } from '@/utils/request'

export default {
  names(connName) { return request.get('/jvm/mbean/names', { params: { connName }}) },
  detail(connName, mBeanName) { return request.get('/jvm/mbean/detail', { params: { connName, mBeanName }}) },
  proxyMXBean(connName, mBeanName, className) { return request.get('/jvm/mbean/proxyMXBean', { params: { connName, mBeanName, className }}) },
  attrValue(connName, mBeanName, attrNames) { return request.get('/jvm/mbean/attrValue', { params: { connName, mBeanName, attrNames }}) },
  invoke(invokeParam) { return request.post('/jvm/mbean/invoke', invokeParam, headers.json) },
  dashboard(connName) { return request.get('/jvm/dashboard', { params: { connName }}) },
  diagnostic: {
    gcClassHistogram(connName, all) { return request.get('/jvm/diagnostic/gcClassHistogram', { params: { connName, all }}) },
    flagsSetted(connName) { return request.get('jvm/diagnostic/flagsSetted', { params: { connName }}) }
  },
  thread: {
    list(connName) { return request.get('/jvm/thread/list', { params: { connName }}) },
    detail(connName, threadId) { return request.get('/jvm/thread/detail', { params: { connName, threadId }}) },
    listTree(connName) { return request.get('/jvm/thread/list/threadPools', { params: { connName }}) },
    checkDeadLock(connName) { return request.get('/jvm/thread/checkDeadLock', { params: { connName }}) }
  }
}
